package com.spark.prepareJob.tags
import com.spark.beans.Logs
import com.spark.prepareJob.constants.AdConstants

/**
  * 4）设备：操作系统|联网方式|运营商
  * 设备操作系统
  * 1	Android	D0001001
  * 2	IOS	D0001002
  * 3	Winphone	D0001003
  * 4	其他	D0001004
  * 设备联网方式
  * WIFI	D0002001
  * 4G	D0002002
  * 3G	D0002003
  * 2G	D0002004
  * NWTWORKOTHER	D0004004
  * 设备运营商方案
  * 移动	D0003001
  * 联通	D0003002
  * 电信	D0003003
  * OPERATOROTHER	D0003004
  * 操作系统：Client
  * 联网方式：Networkmannerid
  * 运营商：Ispid
  */
object DeviceTags extends Tags {
  override def extractTags(log: Logs): Map[String, Int] = {
    null
  }

   def extractTags(logs: Logs,deviceInfo:Map[Int,String],ispInfo:Map[String,String],networkInfo:Map[String,String]):Map[String,Int]={
    val deviceOption = deviceInfo.get(logs.client)
    val client = if(deviceOption.isDefined){
      deviceOption.get
    }else{
      deviceInfo(4)
    }

    val networkName = logs.networkmannername
    val isp = logs.ispname
    Map[String,Int](
      AdConstants.AD_PREFIX_DEVICE + client ->1,
      AdConstants.AD_PREFIX_NETWORK + networkName ->1,
      AdConstants.AD_PREFIX_ISP + isp -> 1
    )
  }
}
